home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_06_02 / v6n2011b.txt < prev    next >
Text File  |  1989-09-26  |  607b  |  25 lines

  1.  
  2.      /* Define the record */
  3.      #define SIZE_A 10   
  4.             /* Max size of string including the NUL terminator */
  5.  
  6.      struct s_record
  7.           {
  8.           char a[SIZE_A];
  9.           int xx;
  10.           ...
  11.           };
  12.  
  13.      struct s_record record;
  14.      int record_number;
  15.  
  16.      /* Write a record */
  17.      record_number = 12;
  18.      fseek(file,(long) RECORD_SIZE * record_number, 0);
  19.      fwrite(&record,RECORD_SIZE,1,file);
  20.      
  21.      /* Read a record */
  22.      record_number = 12;
  23.      fseek(file,(long) RECORD_SIZE * record_number, 0);
  24.      fread(&record,RECORD_SIZE,1,file);
  25.